package net.sxnic.ugr.context;

import javax.servlet.http.HttpServletRequest;

public class AppContext {

	public static final String APPCONTEXT_USERNAME = "appContext_userName";

	public static final String APPCONTEXT_FULLNAME = "appContext_fullName";

	public static final String APPCONTEXT_CSSSTYLE = "appContext_cssStyle";

	public static final String APPCONTEXT_ROLES = "appContext_roles";
	
	public static final String APPCONTEXT_PERMISSIONS = "appContext_permissions";

	public static String getUserName(HttpServletRequest request) {
		return (String) request.getSession().getAttribute(APPCONTEXT_USERNAME);
	}
	
	public static String getUserName(){
		return "ddd";
	}
	
	public static void setUserName(HttpServletRequest request,String userName) {
		request.getSession().setAttribute(APPCONTEXT_USERNAME,userName);
	}

	public static String getFullName(HttpServletRequest request) {
		return (String) request.getSession().getAttribute(APPCONTEXT_FULLNAME);
	}

	public static void setFullName(HttpServletRequest request,String fullName) {
		request.getSession().setAttribute(APPCONTEXT_FULLNAME,fullName);
	}
	
	public static String getCssStyle(HttpServletRequest request){
		return (String) request.getSession().getAttribute(APPCONTEXT_CSSSTYLE);
	}
	
	public static void setCssStyle(HttpServletRequest request,String cssStyle) {
		request.getSession().setAttribute(APPCONTEXT_CSSSTYLE,cssStyle);
	}

	public static void removeAll(HttpServletRequest request) {
		request.getSession().invalidate();
	}

}
